﻿using System.Collections.Generic;
using BlueDot.Data.Core;

namespace SaveRetrieveData.Data.Entities
{
    public class Post : Entity
    {
        #region Fields

        public const string BlogColumnName = "Blog";
        public const string CategoriesColumnName = "Categories";
        public const string PostIDColumnName = "PostID";
        public const string TextColumnName = "Text";
        public const string TitleColumnName = "Title";

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the blog.
        /// </summary>
        /// <value>The blog.</value>
        [Relationship(RelationshipType = RelationShipTypes.OneToMany)]
        public Blog Blog { get; set; }

        /// <summary>
        /// Gets or sets the categories.
        /// </summary>
        /// <value>The categories.</value>
        [Relationship(RelationshipType = RelationShipTypes.ManyToMany)]
        public List<Category> Categories {get;set;}

        /// <summary>
        /// Gets or sets the post ID.
        /// IsUniqueKey: Defines this property as the UniqueKey (Primary Key)
        /// IsGenerated: Defines this property is gernerated by the database. Since
        /// the dataType is an int the DB provider will create the field as an Identity field
        /// </summary>
        /// <value>The user ID.</value>
        [Property(IsUniqueKey = true, IsGenerated = true)]
        public int PostID{get;set;}       

        /// <summary>
        /// Gets or sets the text.
        /// </summary>
        /// <value>The text.</value>
        [Property]
        public string Text {get;set;}
        

        /// <summary>
        /// Gets or sets the title.
        /// </summary>
        /// <value>The title.</value>
        [Property]
        public string Title {get;set;}
        #endregion
    }
}